#for循环进行简单的计算
a = [1,2,3,4,5,6]
for b in a:
    print(b)

#while循环进行简单的计算
a = 1
while a <= 6:
    print(a)
    a += 1


#for实现斐波那契函数
a = -1
b = 1
i = 3
for i in range(3, 100):
    c = a + b
    if c > 100:
        break
    print(c, end=",")
    a = b
    b = c
print("\n")

#用while实现斐波那契函数
a = -1
b = 1
i = 3
while i < 100:
    c = a + b
    if c >100:
        break
    print(c, end=",")
    a = b
    b = c
print("\n")

#rema - week 2-1:
def rema(a,b):
    return a%b
print(rema(1,2))

#自定义函数
class ParamsError(Exception):
    pass

def my_sub(c, d):
    try:
        return c % d
    except ZeroDivisionError:
        raise ParamsError("cannot be Zero, please write again!")
    finally:
        print("function my_sub end")
my_sub(1, 0)
my_sub(1, 1)